package com.example.pojo.pojoenum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

@AllArgsConstructor
@Getter
@Slf4j
public enum DishType {
    BREAK_FAST(1,"早餐"),
    EARLY(2,"早点"),
    LUNCH(3,"午餐"),
    AFTERNOON_TEA(4,"下午茶");
    @EnumValue
    private final int code;
    @JsonValue
    private final String value;
    public static DishType getEnum(String name) {
        for (DishType item : values()) {
            if (item.getValue().equals(name)) {
                return item;
            }
        }
        return null;
    }
}
